package com.xiaoxi.bms.domain.log.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.SneakyThrows;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author xiaoxi
 * @ProjectName bms
 * @PackageName com.xiaoxi.bms.domain.log.vo
 * @ClassName BMSLogOperationVO
 * @Description TODO
 * @Date 2022/11/2 15:56
 * @Version 1.0
 */
@Data
public class BMSLogOperationVO implements Serializable {
    /**
     * 序号
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 用户ip
     */
    private String ip;

    /**
     * 请求uri
     */
    private String uri;

    /**
     * 请求方法
     */
    private String requestMethod;

    /**
     * 请求参数
     */
    private String params;

    /**
     * 响应体
     */
    private String apiResponse;

    /**
     * 操作日志
     */
    private String message;

    /**
     * 操作码
     */
    private String code;

    /**
     * 操作时间
     */
    private LocalDateTime operationTime;

    /**
     * 操作动作
     */
    private String operation;

    /**
     * 操作描述
     */
    private String operationDescribe;

    /**
     * 操作状态 true 操作成功，false 操作失败
     */
    private Boolean status;

    @SneakyThrows
    @Override
    public String toString() {

        String statusMessage = status ? "操作成功" : "操作失败";

        return id + "☆" + username + "☆" + ip + "☆" + uri + "☆" + requestMethod
                + "☆" + params + "☆" + apiResponse + "☆" + message + "☆" + code + "☆"
                + operationTime + "☆" + operation + "☆" + operationDescribe + "☆" + statusMessage;

    }
}
